package org.dlow.socket.serialization;

import org.dlow.common.constants.RpcSerialization;
import org.dlow.spi.ExtensionLoader;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * @description:
 * @Author: 山沐与山
 * @CreateTime: 2024-05-08 11:57
 */
public class SerializationFactory {
    public static org.dlow.socket.serialization.RpcSerialization get(RpcSerialization serialization){
        return ExtensionLoader.getInstance().get(serialization.name);
    }

    public static org.dlow.socket.serialization.RpcSerialization get(String name){
        return ExtensionLoader.getInstance().get(name);
    }

    public static void init() throws IOException, ClassNotFoundException {
        ExtensionLoader.getInstance().loadExtension(org.dlow.socket.serialization.RpcSerialization.class);
    }
}
